package kr.totalcall.controls
{
	import flash.events.FocusEvent;
	import mx.controls.TextInput;

	public class TextInputEx extends TextInput
	{
		public function TextInputEx()
		{
			super();
			addEventListener(FocusEvent.FOCUS_IN, focusIn);
			addEventListener(FocusEvent.FOCUS_OUT, focusOut);
			
			copyMenuEnabled = _copyMenuEnabled;
		}

		public function focusIn(event:FocusEvent):void
		{
			textField.alwaysShowSelection = true;
		}

		public function focusOut(event:FocusEvent):void
		{
			textField.alwaysShowSelection = false;
		}
		
		
		private var _copyMenuEnabled:Boolean = true;
		
		
		public function set copyMenuEnabled(value:Boolean):void{
			_copyMenuEnabled = value;
			if(value){
				TextInputCopyController.controller.addTextInputCopyMenu(this);
			}else{
				TextInputCopyController.controller.removeTextInputCopyMenu(this);
			}
		}
		
		public function get copyMenuEnabled():Boolean{
			return _copyMenuEnabled;
		}
	}
}